package com.bcxj.servicepassengeruser.utils;

import java.util.Random;

public class RandomStringGenerator {

    private static final String ALPHA_NUMERIC_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    public static String generateRandomString(int length) {
        Random random = new Random();
        StringBuilder builder = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            builder.append(ALPHA_NUMERIC_STRING.charAt(random.nextInt(ALPHA_NUMERIC_STRING.length())));
        }
        return builder.toString();
    }

    public static void main(String[] args) {
        String randomString = generateRandomString(10); // 生成长度为10的随机字符串
        System.out.println("Random String: " + randomString);
    }
}